<include file="Public:header" />
<include file="Public:leftside" />
<style type="text/css">
	.file-item {
     padding: 0px!important;
     border: none!important;
	}
</style>
<div class="main-content">
	<div class="breadcrumbs breadcrumbs-fixed" id="breadcrumbs">
		<ul class="breadcrumb">
			<li> <i class="icon-home home-icon"></i>
				<a href="/">首页</a>
			</li>
			<li class="active">更新页面</li>
		</ul>
	</div>
	<section class="scrollable wrapper">
		<!-- 操作提示  start -->
		<!-- 操作提示  end -->

		<section class="panel panel-default">
			<header class="panel-heading font-bold"> 更新页面</header>
			<div class="panel-body">
				<form class="form-horizontal" id="form" name="form" onsubmit="">
					<div class="form-group">
						<label class="col-sm-2 control-label"><span class="required">*</span>页面标题</label>
						<div class="col-md-6">
							<input type="text" class="form-control" id="title" value="{$article.post_title}">
						</div>
					</div>
				
					<div class="line line-dashed line-lg pull-in"></div>
					<!-- 上传图片 -->
					<div class="form-group">
						<label class="col-sm-2 control-label">标题图片</label>
						<div class="col-sm-4">
							<div id="uploader" style="width:200px;overflow:hidden">
			                      <div id="fileList" class="uploader-list">
			                      <div id="WU_FILE_0" class="file-item thumbnail upload-state-done"><img class="img-responsive" src=""></div>
			                      <input type="hidden" name="UpFilePathInfo" value="">
			                     
			                      </div>
			                      <div id="cfilePicker">选择图片</div>
			                </div>
						</div>
					</div>

					<div class="line line-dashed line-lg pull-in"></div>
					<div class="form-group">
						<label class="col-sm-2 control-label">页面作者</label>
						<div class="col-md-4">
							<input type="text" class="form-control" id="author" value="{$article.post_author}">
						</div>
					</div>
					
					<div class="line line-dashed line-lg pull-in"></div>
					<div class="form-group">
						<label class="col-sm-2 control-label">页面关键字</label>
						<div class="col-md-4">
							<input type="text" class="form-control" id="keyword" value="{$article.post_keywords}">
						</div>
					</div>
					<div class="line line-dashed line-lg pull-in"></div>
					<div class="form-group">
						<label class="col-sm-2 control-label">页面摘要</label>
						<div class="col-md-6">
						<textarea id="summary" cols="10" rows="10" class="form-control" style="width:755px;height:150px;">{$article.post_excerpt}</textarea>
						</div>
					</div>
					<!-- 书签 -->
					<div class="line line-dashed line-lg pull-in"></div>
					<div class="form-group">
						<label class="col-sm-2 control-label"><span class="required">*</span>页面内容</label>
						<div class="col-sm-10">
							<textarea  datatype="required" class="editor" rows="10" cols="180" data="商品描述" name="content" >{$article.post_content}</textarea>
						</div>
					</div>
				
					<input type="hidden" name="article_id" id="article_id" value="{$article.id}" />
					<div class="line line-dashed line-lg pull-in"></div>

					<div class="form-group">
						<div class="col-sm-4 col-sm-offset-2">
							<a href="javascript:void(0);" onclick="save(1)" class="btn btn-primary">提交页面</a>
						</div>
					</div>
				</form>
			</div>
		</section>
	</section>
</div>
<script>
//全局变量
    var GV = {
         DIMAUB: "/",
        JS_ROOT: "NewAdmin/js/",
        TOKEN: ""
    };
</script>
<script type="text/javascript" src="/NewAdmin/js/webuploader/webuploader.js"></script>
<script type="text/javascript" src="/NewAdmin/js/webuploader/getting-started.js"></script>
<link rel="stylesheet" href="/NewAdmin/css/webuploader.css" />
<script src="/NewAdmin/js/wind.js"></script>
<link href="/NewAdmin/js/artDialog/skins/default.css" rel="stylesheet" />

<script type="text/javascript">
var BASE_URL = '/NewAdmin/js/webuploader/';
var UPLOAD_SERVER='{:U("User/uploadify_wb")}';
var UpFilePathInfo='{$article.smeta}';
$(function() {
	$('#uploader img').attr('src',UpFilePathInfo);
	$(':input[name="UpFilePathInfo"]').val(UpFilePathInfo);
	$("#uploader").setUploader(null,{uploadImgType:'normal',thumb:{height:102}});
});

   function save(type){
   
    	 var post_title=$("#title").val();
  
   		 var smeta=$("input[name='UpFilePathInfo']").val();
   		 var post_author=$("#author").val();
   		 var post_keywords=$("#keyword").val();
   		 var post_source=$("#summary").val();
   		 var post_content=$(".editor").val();
   		 var id=$("#article_id").val();
    	if(post_title==''){layer.msg('请填写文章标题');return;}

    	if(post_content==''){layer.msg('请填写文章内容');return;}
    	$.ajax({
    		type:"post",
    	    url:'{:U("Portal/updatepage")}',
    	    data:{
    	      'post_title':post_title,   
    		  'smeta':smeta,
    	      'post_author':post_author,
    	      'post_keywords':post_keywords,
    	      'post_source':post_source,
    	      'post_content':post_content,
    	      'id':id,
    	      
    		},
    	    async : true,
    	    success:function(data){
    	    	if(data["code"] > 0) {
					layer.msg('更新成功');
					setTimeout("window.location.href='{:U("portal/page_list")}'",1000)
				} else {
					layer.msg('无数据更新');
				}
    	    } 
    	 
    	});
    	 
    	 
     }

</script>
<include file="Public:footer" />
